package com.stars.questions.deptQuestion.config.entity;

import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.stars.base.entity.BaseEntity;
import org.springframework.util.StringUtils;

/**
 * @author : Rocks
 * @version : 1.0
 * @date : 2022/10/2 22:21
 * @description : 调查问卷子表
 */
@TableName("question_config_sub")
public class QuestionSub extends BaseEntity {

    private String id;
    @TableField(exist = false)
    private JSONObject org;
    @TableField("ORGID")
    private String orgId;
    @TableField("ORGNAME")
    private String orgName;
    @TableField("FID")
    private String fid;
    @TableField("QUESTION")
    private String question;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public JSONObject getOrg() {
        org = new JSONObject();
        org.put("label",this.orgName);
        org.put("value",this.orgId);
        return org;
    }

    public void setOrg(JSONObject org) {
        this.org = org;
    }

    public String getOrgId() {
        if(StringUtils.hasLength(this.orgId)){
            return this.orgId;
        }
        return org.getString("value");
    }

    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }

    public String getOrgName() {
        if(StringUtils.hasLength(this.orgName)){
            return this.orgName;
        }
        return org.getString("label");
    }

    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }

    public String getFid() {
        return fid;
    }

    public void setFid(String fid) {
        this.fid = fid;
    }

    public String getQuestion() {
        return question;
    }

    public void setQuestion(String question) {
        this.question = question;
    }

}
